package org.example;

import redis.clients.jedis.Jedis;

import java.util.concurrent.TimeUnit;

public class Publish {
    public static String channel="cctv.news";
    public static String Pattren="cctv.*";

    public static String[] news={"中美关税最新消息","农业会议召开","大学生就业问题调查报告出炉"};
    public static String[] pnews={"蓝色星球","音乐之声","再相会打卡"};

    public static void getPublish() throws InterruptedException {
        Jedis jedis=new Jedis("127.0.0.1",6379);
        for(String s:news){
            jedis.publish(channel,s);
            TimeUnit.SECONDS.sleep(2);
        }

//        for(String s:pnews){
//            jedis.publish(channel,s);
//            TimeUnit.SECONDS.sleep(1);
//        }
        jedis.close();
    }
}
